package cn.kazuz.common.util.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author kazu
 * @Date 2023/09/24 23:21
 * @Version 1.0
 */
@SuppressWarnings({"all"})
@Configuration
@MapperScan({"cn.kazuz.service.*.mapper"})
public class MybatisPlusConfig {
	
	/**
	 * 添加分页插件
	 */
	@Bean
	public MybatisPlusInterceptor mybatisPlusInterceptor() {
		MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
		interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.ORACLE));//如果配置多个插件,切记分页最后添加
		return interceptor;
	}
}